package com.lwq.imserver.controller;

import com.lwq.imserver.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2022/1/26 15:18
 */
@RestController
@CrossOrigin("*")
public class ChatMessageController {

    @Autowired
    private MessageService messageService;

    @GetMapping("list/page")
    @CrossOrigin("*")
    public Object listPage(
            @RequestParam(required = false) Long timestamp,
            @RequestParam(required = false, defaultValue = "10") Integer size,
            @RequestParam(required = false, defaultValue = "1") Integer page,
            @RequestParam String roomId
    ) {
        return messageService.listPage(timestamp,roomId, page, size);
    }

}
